package com.xadrez.view;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import javax.swing.JLabel;

public class Mouse {
    
    public static int getX(Component componentTemp){
        Container parent;
        if (componentTemp instanceof JLabel) {
            parent = componentTemp.getParent();
        } else {
            parent = (Container) componentTemp;
        }
        Point parentLocation = parent.getLocation();
        
        return parentLocation.x;
    }
    
    public static int getY(Component componentTemp){
        Container parent;
        if (componentTemp instanceof JLabel) {
            parent = componentTemp.getParent();
        } else {
            parent = (Container) componentTemp;
        }
        Point parentLocation = parent.getLocation();
        
        return parentLocation.y;
    }  
}
